package com.example.designdemo.adapter.adapterobject;

import com.example.designdemo.adapter.adapterclass.Source;
import com.example.designdemo.adapter.adapterclass.Targetable;

public class AdapterObjectTest {

    /**
     * 基本思路和类的适配器模式相同，只是将Adapter类作修改，这次不继承Source类，而是持有Source类的实例，以达到解决兼容性的问题
     * @param args
     */
    public static void main(String[] args) {
        Source source = new Source();
        Targetable targetable = new Wrapper(source);
        targetable.method1();
        targetable.method2();
    }
}
